import cv2 as cv
import numpy as np
img=np.zeros((300,400),np.uint8)
step=100
min,max=step,400
for s in range(min,max,step):
    print(s)
    img[:,0+s:min+s]=40+200*s/max
threshold=127
maxValue=255
thresholdType=cv.THRESH_BINARY
ret,thresh1=cv.threshold(img,threshold,maxValue,thresholdType)
cv.imshow('img',img)
cv.imshow('thresh1',thresh1)
cv.waitKey(0)
cv.destroyAllWindows()

# import cv2 as cv
# import numpy as np
# from matplotlib import pyplot as plt
# img=cv.imread('../data/sudoku.png',0)
# img=cv.medianBlur(img,5)
# maxValue=255
# adaptiveMethod=cv.ADAPTIVE_THRESH_MEAN_C
# thresholdType=cv.THRESH_BINARY
# blockSize,C=11,2
# th2=cv.adaptiveThreshold(img,maxValue,adaptiveMethod,thresholdType,blockSize,C)
# titles=['img','adaptive']
# images=[img,th2]
# plt.figure(figsize=(15,15))
# for i in range(2):
#     plt.subplot(1,2,i+1),plt.imshow(images[i],'gray')
#     plt.title(titles[i])
#     plt.xticks([]),plt.ytitcks([])
#
# plt.show()

